package com.jwater.core.common;

/**
 * @description:
 * @author: jnner
 * @createDate: 2021/2/5
 * @version: 1.0
 */
public class JvmNames {
    /**
     * 获取控制台进程标识
     *
     * @param clusterName
     * @return
     */
    public static String getConsoleName(String clusterName) {
        return clusterName + ":console";
    }

    /**
     * 获取管理进程标识
     *
     * @param clusterName
     * @param id
     * @return
     */
    public static String getMasterName(String clusterName, int id) {
        return clusterName + ":master:" + id;
    }

    /**
     * 获取代理进程标识
     *
     * @param clusterName
     * @return
     */
    public static String getProxyName(String clusterName) {
        return clusterName + ":proxy";
    }

    /**
     * 获取工作进程标识
     *
     * @param clusterName
     * @param regionName
     * @param deployName
     * @param groupName
     * @param workerName
     * @param index
     * @return
     */
    public static String getWorkerName(String clusterName, String regionName, String deployName, String groupName,
                                       String workerName, int index) {
        return clusterName + ":worker:" + regionName + ":" + deployName + ":" + groupName + ":" + workerName + ":"
                + index;
    }

    /**
     * 获取离线任务进程标识
     *
     * @param clusterName
     * @param regionName
     * @param deployName
     * @param groupName
     * @param jobName
     * @return
     */
    public static String getJobName(String clusterName, String regionName, String deployName, String groupName,
                                    String jobName) {
        return clusterName + ":job:" + regionName + ":" + deployName + ":" + groupName + ":" + jobName;
    }
}
